<template>
  <div class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('产业地图操作日志') }}</span>
    </div>
    <!-- <el-form ref="queryForm" :model="queryParams" :inline="true">
      <el-form-item :label="$t('操作人')" prop="operPerson">
        <el-input
          v-model="queryParams.operPerson"
          :placeholder="$t('操作人')"
          clearable
          @keyup.enter.native="queryHandle"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t('搜索') }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
      </el-form-item>
    </el-form> -->

    <el-table v-loading="loading" :data="dealEstateMapLogList" border tooltip-effect="darkTable">
      <el-table-column :label="$t('序号')" type="index" align="center" show-overflow-tooltip width="50">
        <template slot-scope="scope">
          {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('操作类型')" align="center" prop="operType">
        <template slot-scope="scope">
          <span v-if="scope.row.operType === 'edit'">编辑</span>
          <span v-else>查看</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('操作人')" align="center" prop="operPersonName" />
      <el-table-column :label="$t('操作时间')" align="center" prop="operTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.operTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList(searchData)"
    />

  </div>
</template>

<script>
import { listDealEstateMapLog } from '@/api/deal/map/dealEstateMap'
export default {
    components: {
    },
  data() {
      return {
          // 遮罩层
          loading: true,
          // 总条数
          total: 0,
          // 产业地图操作日志表格数据
          dealEstateMapLogList: [],
          // 弹出层标题
          title: '产业地图操作日志',
          // 是否显示弹出层
          formOpen: false,
          // 查询参数
          queryParams: {
              operType: undefined,
              operPerson: undefined,
              mapId: undefined,
              operTime: undefined,
              pageNum: 1,
              pageSize: 10
          },
          // 表单参数
          form: {},
          // 表单校验
          rules: {},
          searchData: {}
      }
  },
  created() {
      // this.getList({})
  },
  methods: {
    /** 查询产业地图操作日志列表 */
    getList(data) {
        this.searchData = data
        this.loading = true
        this.queryParams.mapId = data.mapId
        this.queryParams.operType = data.operType
        listDealEstateMapLog(this.queryParams).then(response => {
            this.dealEstateMapLogList = response.rows
            this.total = response.total
            this.loading = false
        }).catch(() => {
            this.loading = false
        })
    },

    // 表单重置
    reset() {
        this.form = {
            id: undefined,
            operType: undefined,
            operPerson: undefined,
            mapId: undefined,
            operTime: undefined
        }
        this.resetForm('form')
    },
    /** 搜索按钮操作 */
    queryHandle() {
        this.queryParams.pageNum = 1
        this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
        this.resetForm('queryForm')
        this.queryHandle()
    }
  }
}
</script>
